Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 2 - Shape Objects / Shape Objects Reference
Functions / Creating and Manipulating Shape Objects


GXGetShapeCacheSize

You can use the GXGetShapeCacheSize function to determine how much memory is allocated to a shape and its cache.

long GXGetShapeCacheSize(gxShape source);
source
A reference to the shape object whose size in memory (including cache) is to be determined.
function result
The approximate number of bytes of memory currently occupied by the shape and cache referenced in the source parameter.
DESCRIPTION
The GXGetShapeCacheSize function, like the GXGetShapeSize function, calculates the size of the source shape in memory, and does not include the memory used by the shape's referenced tags, style, ink, or transform. However, unlike GXGetShapeSize, this function result also includes the size of the source shape's current cache.

This function returns only the memory size currently being used by the shape and its cache. If the shape is unloaded to disk, the result of this function indicates the smaller amount of memory used. If the shape has no cache, the result of this function is simply the memory size of the shape. You can use the GXLoadShape function to load a shape into memory before calling this function, to get the full size of the shape and cache.

In the interest of speed, this function provides only an approximation of the memory requirements of the shape's cache. The actual memory requirements of the cache depend on many factors, such as memory overhead, and would be less efficient to calculate. You can use this function to determine an approximate size for the memory partition needed for a set of shapes to be loaded and cached at the same time.

To determine the amount of memory occupied by a shape and its cache, use this function. To build a shape cache, use the GXCacheShape function. To delete a shape cache, use the GXDisposeShapeCache function.

ERRORS, WARNINGS, AND NOTICES
Errors 
shape_is_nil 
SEE ALSO
Shape caches are discussed in the section "Caching Shape Objects" beginning on page 2-27. The GXCacheShape function is described on page 2-62. The GXDisposeShapeCache function is described in the previous section.

The GXLoadShape function is described in the memory management chapter of
Inside Macintosh: QuickDraw GX Environment and Utilities.

To determine the amount of memory occupied by a shape without its cache, use the GXGetShapeSize function, described on page 2-56.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996